#ifndef SNAKEPLAYER_H_
#define SNAKEPLAYER_H_

#include <list>
#include "SnakeSegment.h"
using namespace std;

class SnakePlayer
{
public:
	Direction lastDir;
	
	/* constructor for normal player*/
	SnakePlayer(int number);
	/* constructor for virtual player*/
	SnakePlayer(int number, int virtualSnakeFirstX,int virtualSnakeFirstY);
	int moveTo(Direction d);/*checks what's on target field and return result what eaten(snake,apple,nothing) */
	void eatApple(int endX,int endY);
	void drawMeOnMap();
	void reset();//leaves only head in random pos and resets GOver
	void backRevisionNum(int number_of_revisions);/*backs to snake position in past (according to number of turns) */
	int getNumber(){
		return number;
	}
	bool getGameOver(){
		return gameOver;
	}
	void setGameOver(bool val){
		this->gameOver = val;
	}
	
	void setVirtualPlayerState(bool state)
	{
		virtualPlayerState = state;
	}
	
	bool isVirtualPlayer()
	{
		return virtualPlayerState;
	}
	
	static int eatenAnotherSnake;//mean game over
	static int eatenApple;//maybe some (debug)use
	static int eatNothing;
	static int eatenMine;
	static int endedPlay;

	SnakeSegment * getHeadSegment();
	void setHeadSegmentCoords(int x,int y);
	bool isThatMySegment(int x,int y);//returns true if (x,y) belongs to this snake
public:
	~SnakePlayer(void);
private:
	int startup_x;
	int startup_y;
	void updateDirections();
	list<SnakeSegment *> segments;
	int number;
	bool gameOver;
	bool virtualPlayerState;/* if so, map won't use its logic for this snake */
};


#endif /*SNAKEPLAYER_H_*/
